package com.skynet.backend.auth.common.util;


import com.skynet.backend.auth.common.enums.ResultEnum;
import com.skynet.backend.auth.sys.vo.ResultVO;

import static com.skynet.backend.auth.common.enums.ResultEnum.RESPONSE_SUCCESS;

/**
 * @author Skynet
 * @date 2017年11月23日 16:14
 */
public class ResultVOUtil {

    private ResultVOUtil() {
    }

    public static ResultVO success(Object data) {
        ResultVO resultVO = new ResultVO();
        resultVO.setCode(RESPONSE_SUCCESS.getCode());
        resultVO.setMsg(RESPONSE_SUCCESS.getMsg());
        resultVO.setData(data);
        return resultVO;
    }

    public static ResultVO error(ResultEnum resultEnum) {
        ResultVO resultVO = new ResultVO();
        resultVO.setCode(resultEnum.getCode());
        resultVO.setMsg(resultEnum.getMsg());
        return resultVO;
    }
}
